<? if(0) {?>//<script language="Javascript"><? }


if(!$_query_dummies [ "mod_object" ][ "list" ] ) $_query_dummies [ "mod_object" ][ "list" ]	= "ID, date_format(flog, '%d.%m %y') as pdate, <%lang:mod_object.nameid%> as short";

//////////////////  ASSETS  //////////////////
if($_set->wtype == "win") {
//////////////////////////////////////////////
	
	///////////// INIT ASSET
	if($_set->action == "init") { ?>
		
		ref.seed([
			new Element( "span", { style: "font-size:18px" }).update( "Welkom " ),
			new Element( "a", { href:"#", style: "font-size:18px" }).update( "<?= $Engine->user('user'); ?>" ),
			new Element( "span", { style: "font-size:18px" }).update( ", " ),
			new Element( "span" ).update( "wat wil je doen?" ), br, br,
			new Button( { id:ref.id+".btn.newsnew", descr: "add newspost", func:"window", tool:"text.news", action:"edit.new", meta: {descr: "breaking news"}} ),
			tag("div", {id:"sitemap", style:"margin-top:20px;"})
		]);
		
		$(ref.id+'.btn.newsnew').observe('click', function(e){ $('column_right').insert( new Win("asset.group.news.new").request({tool:"text.news", action:"edit.new", vars: {descr: "breaking news"}}) ); });
		
		
		<? 
		$map = $Engine->object->filter( "page", "active order by parent, hierarchy" );
		
		foreach($map as $m) {
			$lang[] = (int)$m['nameid'];
			$level[(int)$m['parent']][] = $m;
		}
		$lang = $DB->lang($lang);
		
		function floatgroup($id) {
			global $lang, $level;
			foreach($level[$id] as $p) $group[] = "{id:".$p['ID'].", type:'page', tool:'object.page', name:\"".strlimit( $lang[$p['nameid']], 12)."\", descr:\"subs\", meta:{ subtype:'page', floats:".(($level[(int)$p['ID']])? floatgroup((int)$p['ID']) : "[]" ).", active:".$p['active']."}, traceback:1}";
			return "[".implode(",",$group)."]";
		}

		?>
		
		win.asset.dropbox.build({id:'sitemap', descr:'Sitemap', tool:'object.page', type:'page', 'new':"add page",  floats:<?= floatgroup(0); ?>});
		
	<? exit(); }

////////////////  OBJECT ASSETS (basic)
if($_tool[1] == "basic") {

////////////////// LIST OBJECTS
	if($_set->action == "list"){ ?>

		ref.seed([
			tag("font", {style:"font-size:18px"}, "<?= ucfirst($_set->vars->descr)?>"), br, br,
			new List({id:ref.id+".lst", tool:'object.basic', descr:'<?=$_set->vars->boxdescr?>', new:'add <?=$DB->type_r( $_set->vars->objtype )?>', meta:ref.vars})
		]);
		
		
		$(ref.id+".lst").seed(<?= $_set->parse_list() ?>);
		
	<? }

///////////// EDIT OBJECT
	if(($Request->action == "edit" || $Request->action == "edit.new") && $DB->type( $Request->vars->type, "table" ) == "mod_object" ){
	
		
		$Object = new OBJECT( $Request->vars->type, ( $Request->action == "edit.new" )? 0 : $Request->vars->id );
		$id = $Object->get('ID');
		
		
		if($Request->action == "edit.new") {

			?>
			ref.vars.id = <?=$id?>;
			win.float.list["float_"+ref.vars.type + "." + ref.vars.id] = obj = {id:ref.vars.id, type:'object', tool:'object.basic', name:"...", descr:"", objtype:ref.vars.objtype, list:[{ref:'name'},'...',5], meta:{objtype:ref.vars.objtype, img:''}};
			$(ref.vars.parent).vars.floatlist.push(ref.vars.id);
			
			$(ref.vars.parent+".tbody").insert({before: new win.trfloat(obj)});
			
			<?
		} 
		
		
		
		$langs		= $Engine->text->filter( $Object->get( 'nameid' ));
		$longs		= $Engine->text->filter( $Object->get( 'textid' ), "long" );
		
		
			
		function floatgroup( $id ) {
			global $DB, $Request;
			
			if( $list = $DB->reference( $Request->vars->type, "ID=$id", "media.img" ))
				foreach($list as $el) $group[] = "{id:$el, type:'img', tool:'media.img', name:\"$el\", descr:'img', meta:{ objtype:".$DB->type( 'media.img' ).", img:$el }}";
			
			return "[".(($group)?implode(",",$group):"")."]";
		}
		
		//if(!$link = $DB->get( "link", "ID =". $DB->reference_single( $_set->vars->type, $id, "link" ) .")", "ID, url" )) $link['ID'] = 0;
		//if(!$stream	= $DB->get( "media.vid.youtube", "ID =". $DB->reference_single( $_set->vars->type, "parentid = {$id}", "media.vid.youtube" ) .")", "ID, meta" )) $stream['ID'] = 0;

		?>	
		
		
		ref.seed([
			tag("font", {style:"font-size:18px"}, "Beheer <?= $DB->type_r( $Request->vars->objtype ) ?> "), tag("a", {id:ref.id+".h1", href:"http://<?=engine_get('control.public')?>/bio&objid="+ ref.vars.id, target:"_blank", style:"font-size:18px"}, "<?=$Object->get( 'name' )?>"), " (view)", br, br,
			tag("input", {id:ref.id+".title"}), tag("div", {id:ref.id+".text"}),  br, tag("div", {id:ref.id+".imgs"}),
			new Options({id:ref.id+".options", tool:'group.basic', descr:'Opties', floats: [
				new Shift({id:ref.id+".publish", type:'object', action:'shift', descr:'is public', tool:'object.basic', meta:{ value:<?=( $Object->get('active')==1)?1:0;?>, options:[0,1], field:"active", objid:ref.vars.id}})
			], meta:{}})
		]);
		
		groups = {
			extra		: [ tag("div",{id:ref.id+".isactive"}), tag("input",{id:ref.id+".link", style:"width:320px;"}), tag("input",{id:ref.id+".yt", style:"width:320px;"}) ]
		};

		[	{id:ref.id+".title",descr:'name band', direct:1, parenttype:"object", parentid:ref.vars.id, textid:<?=$Object->get( 'nameid' )?>, values:<?=($langs)?json_encode($langs):"{}"?>},
			{id:ref.id+".text", rich:1, ref:'basictxt', descr:'description', parenttype:"object", parentid:ref.vars.id, direct:1<?=($Object->get( 'textid' ))?",textid:".$Object->get( 'textid' ):""?>, values:<?=($longs)?json_encode($longs):"{}"?>},
		].each(function(obj){ win.asset.txtfield.build(obj); });
		
		win.asset.dropbox.build({id:ref.id+".imgs", descr:'Images', tool:'media.img', type:'img', new:"add image", objtype:<?=$Request->vars->objtype?>, childtype:<?=$DB->type( 'media.img' )?>, objid:ref.vars.id, floats:<?=floatgroup($id);?>});
		
		///// IMG BUTTON, CODE SHOULD BE IN DROPBOX CLASS
		Object.extend(loadcluster.init, {
			button_placeholder_id:ref.id+".imgs.new.txt",
			post_params : { account :'<?=ACCOUNT?>', auth:<?=$_SESSION['uid']?>, objtype : <?=$DB->type( "media.img" )?>, parenttype:ref.vars.objtype , parentid:ref.vars.id },
			custom_settings : { float_target : ref.id+".imgs", objtype : <?=$DB->type( "media.img" )?> }
		} );
		var swfu = new SWFUpload(loadcluster.init);


	<? exit(); }
	
}

///////////// EDIT MODULE

	////////////////  MODULE ASSETS
	if(( $Request->action == "edit" || $Request->action == "edit.new") && $Request->vars->type == "mod" ){
	
		$Page = new PAGE( $_set->vars->parentid );
	
		if( $Request->action == "edit.new" ){
			
			if( !$_set->vars->modtype ) $_set->vars->modtype = "text.basic";
			$mod = $Page->mods->create( $_set->vars->modtype, $_set->vars->ctype );
			
			?>
			
			console.log( this )
			
			<?

		} else
			$mod = $Page->mods->request_json( $_set->vars->id );

			
		
			
			/*$module = $Page->mods->request_json( $_set->vars->meta->objid );
			
			$DB->query("INSERT INTO moddump (json, llog, author) values('". json_encode( $module ) ."', now(),".$_SESSION['uid'].")", 0 );
			$id = $_set->vars->id = (int) $DB->query_direct( "select max(ID) from moddump" );
			
			if( !$pagemods = $Page->get( "mods" )) $pagemods = (object) array();
			
			$pagemods->{ $_set->vars->ctype }[] = $id;
			$DB->query("update pages set mods='". json_encode( $pagemods ) ."' where ID='". $_set->vars->parentid ."'");
			
			$idstring = $_set->vars->page . "." . $_set->vars->ctype;
			?>
			$("<?= "page.$idstring.box"?>").appendChild( win.float.el({id:"<?= "$id.". $idstring .".". rand()?>", type:'mod', tool:'object.mod', name:"...", descr:"<?=$_set->vars->modtype?>", meta:{ page:"<?=$_set->vars->page?>", column:"<?=$_set->vars->ctype?>", objid:<?=$id?>}}) );
			win.asset.dropbox.list["sitemap"].floats.push(<?=$id?>);
			win.asset.dropbox.sortable("<?=$_set->vars->type;?>");

		<? } else $module = $Page->mods->request_json( $_set->vars->meta->objid );
		
		
		if( $module->nameid ) {
			$langs	= $Engine->text->filter( $module->nameid );
			$title	= $langs[ LANG ];
		}
		if( $module->textid ) {
			$long	= $Engine->text->filter( $module->textid, "long" );
		}
		
		?>

		ref.seed([
			tag("font", {style:"font-size:18px"}, "Beheer module "), tag("a", {id:ref.id+".h1", href:"http://<?=engine_get('control.public')?>/<?=$_set->vars->meta->page?>", target:"_blank", style:"font-size:18px"}, "<?=$title?>"), " (view)", br,
			tag("input", {id:ref.id+".title"}), tag("div", {id:ref.id+".text"})
		]);
		
		
		[{id:ref.id+".title",descr:'name page', direct:1, parenttype:"mod", parentid:<?= $_set->vars->meta->objid ?> <?=($module->nameid)?",textid:".$module->nameid:""?>, values:<?=($langs)?json_encode($langs):"{}"?>},
		{id:ref.id+".text", rich:1, ref:'basictxt', descr:'basic text (optional)', parenttype:"mod", parentid:<?= $_set->vars->meta->objid ?>, direct:1<?=($module->textid)?",textid:".$module->textid:""?>, values:<?=($long)?json_encode($long):"{}"?>}].each(function(obj){ win.asset.txtfield.build(obj); });

		<?*/
		

	exit(); }

////////////////  PAGE ASSETS
	if($_tool[1] == "page") {

////////////////// EDIT PAGE
	if( $Request->action == "edit" || $Request->action == "edit.new" ) {

		
		$Page = ( $Request->action == "edit.new" )?
			new PAGE( null, "..." ) : new PAGE( $Request->vars->id );
		
		$id = $Page->get( 'ID' );

		if( $Request->action == "edit.new" ) {
			?>
			
			$("sitemap.box").appendChild( win.float.el({id:<?=$id?>, type:'page', tool:'object.page', name:"...", descr:"subs", meta:{ floats:[], subtype:'page', status:2}}) );
			win.asset.dropbox.list["sitemap"].floats.push(<?=$id?>);
			win.asset.dropbox.sortable("<?=$_set->vars->type;?>");

			<?
		}
		
		if( $Page->get( "nameid" ))
			$langs	= $Engine->text->filter( $Page->get( "nameid" ));

		if( $Page->get( "textid" ) )
			$long	= $Engine->text->filter( $Page->get( "textid" ), "long" );
		
		//MODS
		if( $Page->mods->ids() && $mods = $Page->get( 'mods' ))
			foreach( $mods as $ckey => $column )
				if ( count($column ))
					$modcluster[ $ckey ] = $Page->mods->filter_core( $ckey );


		foreach( json_decode( engine_get( "control.columns" )) as $clm)
			$droppack[] = "new Dropbox({ descr:'$clm', type:'module', tool:'object.mod', blank:'add module', ctype:'$clm', floats:[{$modcluster[ $clm ]}], page:'{$Page->name}', parentid:$id })";
		
		
	?>

		ref.seed([
			
			new Element( "h1" ).update( "Beheer pagina " ).insert( new Element( "a", { href:"http://<?=engine_get('control.public')?>/<?=$Page->get('name')?>", target:"_blank" }).update( "<?=$Page->get('title')?>" )),
			tag("input", {id:ref.id+".title"}),
			new Element( "h2" ).update( "Structuur" ),
			<?=implode(", ", $droppack)?>,
			new Options({id:ref.id+".options", tool:'group.basic', descr:'Opties', floats: [
				new Shift({id:ref.id+".publish", type:'page', action:'shift', descr:'Show in menu', tool:'object.page', meta:{ value:<?=( $Page->get( 'active' ) == 1 )?1:0;?>, field:'active', options:[2,1], objid:ref.vars.id}})
			], meta:{}}),
			tag("div", {id:ref.id+".comment"})
		]);
		
		win.asset.txtfield.build(
			{id:ref.id+".title",descr:'name page', direct:1, parenttype:"page", parentid:<?=$Page->get('ID')?>, traceback:<?= json_encode($_set->vars->traceback) ?>, textid:<?=$Page->get('nameid')?>, values:<?=json_encode($langs)?>}
		);

	<? }
	exit(); }



/*
////////////////  USER ASSETS
if($_tool[1] == "user") {

////////////////// LIST USERS
	if($_set->action == "list"){

		if($_set->vars->reqs) foreach(get_object_vars($_set->vars->reqs) as $key=>$val) $reqs .= " AND `$key`=\"$val\"";
		if($_set->vars->order) foreach(get_object_vars($_set->vars->order) as $key=>$val) $order[] = "`$key` $val";
		$objects = $DB->parse("*", "mod_object", "`type`=".$_set->vars->objtype.$reqs.(($order)?" ORDER BY ".implode(", ",$order):"").(($_set->vars->limit)?" LIMIT ".$_set->vars->limit:""), true);
		if($objects) {
			foreach($objects as $obj) {
				$lang[] = (int) $obj['nameid'];
				$descr[] = (int) $obj['descrid'];
				$ids[] = $obj['ID'];
			}
			$lang = $DB->lang($lang);
			$descr = $DB->lang($descr,"long");
			if($_set->vars->imgtype) $imgs  = $DB->parse_by(array('parentid','objid'),'glue_object',"parenttype=".$_set->vars->objtype." AND objtype".(is_array($_set->vars->imgtype)? " IN(".implode(",",$_set->vars->imgtype).")": "=".$_set->vars->imgtype)." AND parentid IN(".implode(",",$ids).")");
			
			foreach($objects as $obj) $dump_js[] = "{id:".$obj['ID'].", type:'".$_set->vars->type."', tool:'object.basic', name:\"".(($_set->vars->namekey)? $obj[$_set->vars->namekey]:$lang[$obj['nameid']])."\", descr:\"".substr($descr[$obj['descrid']],0,24)."\", meta:{objtype:".$_set->vars->objtype.", img:'".$imgs[$obj['ID']]['objid']."' }}";
		}
		
		if($_set->vars->limit && count($dump_js) == (int) $_set->vars->limit ) $total = $DB->short("COUNT(*)", "mod_object as o", "`type`=".$_set->vars->objtype.$reqs);
		?>

		//ref = <?=$_POST['set']?>;
		ref.seed([
			tag("font", {style:"font-size:18px"}, "<?= ucfirst($_set->vars->descr)?>"), br,
			tag("div", {id:ref.id+".list", style:"margin-top:20px;"})
		]);
		
		win.asset.dropbox.build({id:ref.id+".list", descr:ref.vars.boxdescr, type:'prod', new:"add new", reqs:ref.vars.reqs, order:ref.vars.order, objtype:ref.vars.objtype, imgtype:ref.vars.imgtype, namekey:ref.vars.namekey, <? if($total) echo "flow:{total:$total, cur:0, itv:".$_set->vars->limit."}, "; ?>floats:[<?=($dump_js)?implode(",",$dump_js):"";?>]});

	<? exit(); }
}
*/


///////////////// AJAX COMM //////////////////
} else if($_set->wtype == "push") {
//////////////////////////////////////////////


/////////////////////////// MODULE ORDER / STATUS
////////////////// CHANGE ORDER
	if( $_set->action == "hierarchy" && $_set->vars->type == "mod" ) {

		$Page = new PAGE( $_set->vars->parentid );
		$mods = $Page->get( "mods" );
		foreach( $_set->vars->floats as $float ) {
			$farray = explode(".", $float );
			$order[] = (int) $farray[0];
		}
		$mods->{ $_set->vars->ctype } = $order;
		$DB->query("update pages set mods='". json_encode( $mods ) ."' where ID=" . $_set->vars->parentid, 0 );
	
		?>
		dashboard.comment("order updated.");
		<?

	exit(); }

////////////////// DUMP ELEMENT
	if( $_set->action == "kill" && $_set->vars->type == "mod" ) {
		
		$Page = new PAGE( $_set->vars->meta->page );
		
		$mods = $Page->get( 'mods' );
		foreach( $mods->{ $_set->vars->meta->column } as $mod ) {
			if( $mod != $_set->vars->meta->objid ) $order[] = $mod;
		}
		if( count($order) ) $mods->{ $_set->vars->meta->column } = $order;
		else unset( $mods->{ $_set->vars->meta->column } );
		
		$DB->query("update pages set mods='". json_encode( $mods ) ."' where name='". $_set->vars->meta->page ."'");
		$DB->query("update moddump set active=0 where ID='". $_set->vars->meta->objid ."'");
	
		?>
		dashboard.comment("<?=$_set->vars->name?> removed.");
		<?
		
	exit(); }



/////////////////////////// ELEMENT ORDER / STATUS
////////////////// CHANGE ORDER
if($_set->action == "hierarchy") {
	// SITEMAP
	if($_set->vars->type == "page"){
	
		if($_set->vars->id == "sitemap") $_set->vars->id = 0;
		foreach($_set->vars->floats as $k => $v) $DB->query("UPDATE `pages` SET `hierarchy`=$k, llog=NOW() WHERE `ID`=$v AND parent=".$_set->vars->id);
		
		if($_set->vars->addchild) foreach($_set->vars->addchild as $v) $DB->query("UPDATE `pages` SET parent=".$_set->vars->id.", llog=NOW() WHERE `ID`=$v");
		?>
		ref.id = "sitemap.comment";
		xhttp.gfx("hierarchy updated", ref.id);
	
	<? }

	// COLUMN
	if($_set->vars->type == "mod"){													
		$tree = explode(".",$_set->vars->id);
		array_shift($tree);
		$column = array_pop($tree);
		
		$Page = new PAGE( implode( ".", $tree ));
		$_mods = $Page->get( "mods" );
		foreach($_set->vars->floats as $fl) {
			$key = str_replace( $Page->name .".$column.", "", $fl );
			$fresh[ $key ] = $_mods->{$column}->{$key};
		}
		$_mods->{$column} = $fresh;
		$DB->query("UPDATE `pages` SET mods='".json_encode($_mods)."', llog=NOW() WHERE `ID`=".$Page->get( "ID" ), 0 );
		?>
		xhttp.gfx("order updated", ref.id);
	<? }

exit(); }

////////////////// ADD ELEMENT
if($_set->action == "add") {
		
	if($_set->vars->type == "mod") {
		
		$wtypes = array("main"=>"win", "left"=>"wgt", "right"=>"wgt", "bottom"=>"win");

		$tree = explode(".",$_set->vars->id);
		array_shift($tree);
		$column = array_pop($tree);
		$Page = new PAGE( implode( ".", $tree ));
		$_mods = $Page->get( "mods" );
		
		$am = -1; $type = "text";
		if($_mods->{$column}) foreach($_mods->{$column} as $key => $mod) {
			$broken = explode(".",$key);
			if(count($broken) > 1 && $broken[0] == $type) $am = (int)array_pop($broken);
			$wtype = $mod->wtype;
		}
		
		$textid = $Engine->text->maxid();
		$DB->query("INSERT INTO `txtdump` (`textid`,`lang`,`short`,`llog`,`author`) VALUES (".++$textid.", '".LANG."', '...', NOW(), ".$_SESSION['uid'].")", 0 );
		$DB->query("INSERT INTO `txtdump` (`textid`,`lang`,`long`,`llog`,`author`) VALUES (".++$textid.", '".LANG."', '...', NOW(), ".$_SESSION['uid'].")", 0 );

		
		$_mods->{$column}->{"$type.".++$am} = array("wtype"=>$wtypes[$_set->vars->ctype], "tool"=>"basic", "nameid"=>$textid-1, "textid"=>$textid);
		$DB->query("UPDATE `pages` SET mods='".json_encode($_mods)."', llog=NOW() WHERE `ID`=".$Page->get( 'ID' ));
		?>
		
		$(ref.id+".box").appendChild( win.float.el({id:"<?="{$Page->name}.$column.$type.$am"?>", type:'mod', action:'edit.mod', tool:'text.basic', name:"...", descr:"text block", meta: {"page": "<?=$Page->name?>", column: "<?=$column?>", mod: "<?="$type.$am"?>", modvars: <?=json_encode($_mods->{$column}->{"$type.$am"})?>}}) );
		win.asset.dropbox.list[ref.id].floats.push("<?="{$Page->name}.$column.$type.$am"?>");
		win.asset.dropbox.sortable("<?=$_set->vars->type;?>");
		
		<?
	}

exit(); }


/////////// LIST CONTROL

if($_set->action == "list") { ?>

	$(ref.trg).seed(<?= $_set->parse_list() ?>);
	
<? exit(); }

if( strstr( $_set->action, "flow") ) { ?>
	
	$('control_list')._push(ref.trg, <?= $_set->flow() ?> );

<? exit(); }


////////////////// DUMP ELEMENT
if($_set->action == "kill") {
	// PAGE
	if($_set->vars->type == "page"){ 
		if( (int) $DB->get_key( "page", "ID=". $_set->vars->id, "active")) $DB->query("UPDATE `pages` SET `active`=0, llog=NOW() WHERE `ID`=".$_set->vars->id, 0 );
		else {
			$DB->query("DELETE FROM pages WHERE !active AND ID = {$_set->vars->id} LIMIT 1", 0 );
			$DB->query("UPDATE txtdump SET active = 0 WHERE textid IN (SELECT nameid, textid FROM pages WHERE ID = {$_set->vars->id})", 0 );
		} ?>
		xhttp.gfx("<?=$_set->vars->name?> removed to dump", ref.id);

	<? }
	
	// OBJECT
	if($_set->vars->type == "object" || $DB->type( $_set->vars->type, "table" ) == "mod_object" ){

		if( (int) $DB->get_key( $_set->vars->type, "ID=".$_set->vars->id, "active" )) {
			$DB->query( "UPDATE mod_object SET active=0 WHERE ID=".$_set->vars->id, 0 );
			$comment = $_set->vars->name." disabled to dump";
		} else {
			$DB->query( "UPDATE txtdump SET active=0 WHERE textid IN (SELECT nameid, textid FROM mod_object WHERE ID=".$_set->vars->id.")");
			$DB->query( "UPDATE db_media SET active=0 WHERE ID in (select objid from glue_object WHERE (parenttype = " . $_set->vars->objtype . " AND parentid =".$_set->vars->id."))");
			$DB->query( "DELETE FROM glue_object WHERE (parenttype = " . $_set->vars->objtype . " AND parentid =".$_set->vars->id.") OR (objtype = " . $_set->vars->objtype . " AND objid =".$_set->vars->id.")");
			$DB->query( "DELETE FROM mod_object WHERE active=0 AND ID=".$_set->vars->id." LIMIT 1");
			$comment = $_set->vars->name." removed!";
		} ?>
		xhttp.gfx("<?=$comment?>", "listfloat.flow");

	<? }
	
	// MOD
	if($_set->vars->type == "mod"){
		
		$Page = new PAGE( $_set->vars->meta->page );
		$_mods = $Page->get( "mods" );
		unset($_mods->{$_set->vars->meta->column}->{$_set->vars->meta->mod});
		$DB->query("UPDATE `pages` SET mods='".json_encode($_mods)."', llog=NOW() WHERE `ID`=".$Page->get( 'ID' ), 0 );
		
		foreach(array("textid","textid","nameid") as $id) if($val = $_set->vars->meta->modvars->{$id}) $textid[] = $val;
		$DB->query("UPDATE `txtdump` SET active=0, llog=NOW() WHERE textid IN(".implode(",",$textid).")", 0 );
		?>
		xhttp.gfx("<?=$_set->vars->name?> deleted", ref.id);

	<? }

}

////////////////// SHIFT FUNCTIONALITIES
if($_set->action == "shift") {

	$comment = ( $_set->shift() )? "option modified":"warning: failed";

	?>
	xhttp.gfx("<?=$comment?>", ref.id);
	<?
	
exit(); }

////////////////// PULL FUNCTIONALITIES
if($_set->action == "pull") {

	$result = $_set->pull();

	?>
	$(ref.trg).seed([<?= $result ?>],false);
	$(ref.trg).stopObserving('mouseover');
	<?
	
exit(); }

////////////////// OBJLIST FUNCTIONALITIES
if($_set->action == "list.order") {

	?>
	
	win.asset.objlist.refresh("<?=$_set->trg?>", [<?=($objects)?implode(",",$objects):"";?>], "<?=$_set->vars->type?>");
	
<? exit(); }

////////////////// AJAX (direct) UPDATE FUNCTIONALITIES
if($_set->action == "ajax") {
	
	$comment = ( $_set->ajax() )? "updated element":"warning: failed";
	
	?>
	dashboard.comment("<?=$comment?>");
	<?
	
exit(); }





////////////////  OBJECT (basic)
if($_tool[1] == "basic") {

////////////////// LIST OBJECTS
	if($_set->action == "list.update"){ ?>
		
		xhttp.gfx("toont <?= $_flow->cur*$_flow->itv + 1;?> - <?= (($_flow->cur+1)*$_flow->itv<$_flow->total)? ($_flow->cur+1)*$_flow->itv: $_flow->total;?> van <?= $_flow->total;?>", ref.id ); 
		win.asset.dropbox.refill("<?=$_set->vars->id?>", [<?=($objects)?implode(",",$objects):"";?>]);

	<? exit(); }
}
}